<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        ul{
            list-style: none;
            /* overflow: hidden; */
            height: 20%;
        }
        .wrapper{
            margin: 100px auto;
            width: 1200px;
            height: 650px;
        }
        .img{
            display: block;
            width: 100%;
            height: 80%;
        }
        .wrapper .imgLi{
            float: left;
            height: 100%;
            width: 20%;
            cursor: pointer;
        }
        .wrapper .imgLi img{
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
    <div class="wrapper">
        <img src="img/m1.jpg" alt="" class="img">
        <ul class="ul">
            <li class="imgLi"><img src="" alt=""></li>
            <li class="imgLi"><img src="" alt=""></li>
            <li class="imgLi"><img src="" alt=""></li>
            <li class="imgLi"><img src="" alt=""></li>
            <li class="imgLi"><img src="" alt=""></li>
        </ul>
    </div>
    <script>
        var arr = ['m1.jpg', 'm2.jpg', 'm3.jpg', 'm4.jpg', 'm5.jpg'];
        var imgs = document.querySelectorAll('.imgLi img');
        var img = document.querySelector('.img');

        // 动态添加图片，并绑定点击事件
        for (var i = 0; i < arr.length; i++) {
            imgs[i].src = 'img/' + arr[i];
            imgs[i].onclick = function () {
                img.src = this.src;
            }
        }
    </script>
</body>
</html>